package com.yict.csms.system.dao.impl;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.yict.common.dao.impl.CommonDao;
import com.yict.csms.system.entity.UserGroupPermission;
import com.yict.csms.system.entity.UserGroupTreeNode;


/**
 * 
 * 
 * @author ryan.wang
 * 
 */
@Repository
public class UserGroupTreeNodeDaoImpl extends CommonDao<UserGroupTreeNode, Long> {

	public boolean check(Long userGroupId) {
		String queryString = " from UserGroupTreeNode as u where u.UserGroup.userGroupId =:userGroupId";
		try {
			Query query = this.getSession().createQuery(queryString);
			query.setParameter("userGroupId", userGroupId);
			List<UserGroupTreeNode> list = query.list();
			if (list != null && list.size() > 0) {
				return true;
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}

}
